<link href="/static/plugs/layui/css/layui.css" rel="stylesheet" />
<link href="/static/index/header.css?v=3" rel="stylesheet" />
<div class="header">
  <div class="header_section">
    <img src="/static/index/img/logo.png" class="logo" />
  </div>
  <div class="bar">
    {foreach $mcat_arr as $k=>$v}
    <div class="mtit pro_menu">
      <span style="color: #fff">{$v.name}</span>

      <div class="product_menu">
        {if !empty($v.sub)} {foreach $v.sub as $sk=>$sv}
        <div class="nav_section">
          <div class="lever1"><a href="/index/index/plist?cat={$sv.id}">{$sv.name}</a></div>
          {if !empty($sv.sub)} {foreach $sv.sub as $dk=>$dv}
          <div class="dlist">
            <a href="/index/index/plist?cat={$dv.id}">{$dv.name}</a>
          </div>
          {/foreach} {/if}
        </div>
        {/foreach} {/if}
      </div>
    </div>
    {/foreach}

    <div
      class="search_section"
      style="float: right; width: 240px; height: 40px; margin-top: 20px; margin-right: 40px; position: relative">
      <input
        value=""
        placeholder="请输入搜索编号"
        style="
          float: left;
          width: 100%;
          height: 100%;
          padding: 5px;
          box-sizing: border-box;
          border: 0px;
          border-radius: 4px;
        "
        id="search_txt" />
      <i
        class="layui-icon-search layui-icon"
        style="
          position: absolute;
          font-size: 25px;
          line-height: 40px;
          margin-left: 10px;
          cursor: pointer;
          right: 5px;
          color: rgb(0, 56, 101);
        "
        lay-on="search_fun"></i>
    </div>
  </div>
</div>

<script src="/static/plugs/layui/layui.js"></script>

<script language="javascript" src="/static/plugs/jquery/jquery.min.js"></script>

<script>
  layui.use(['form', 'laydate', 'util'], function () {
    var util = layui.util

    util.on('lay-on', {
      // 获取验证码
      search_fun: function (othis) {
        var txt = $('#search_txt').val()
        if (txt !== '') {
          $.post('/index/index/search_fun', { txt: txt }, function (res) {
            console.log(res)
            //if(res.code=="n"){layer.msg('无相关信息');}else{window.location.href="/index/index/plist?id="+res.id;}
            if (res.code == 'n') {
              layer.msg('无相关信息')
            } else {
              window.location.href = '/index/index/intro?id=' + res.id
            }
          })
        }
      }
    })
  })

  /*var pmenu_pos=document.getElementById("pro_menu");
   
    var show_pos=document.getElementsByClassName("product_menu")[0];
    
    pmenu_pos.onmouseover = function(e){show_pos.style.display="block";}*/

  $(document).on('mouseover', '.pro_menu', function (e) {
    // show_pos.style.display="none";
    $(this).find('.product_menu').css('display', 'block')
  })

  $(document).on('mouseout', '.pro_menu', function (e) {
    // show_pos.style.display="none";
    $(this).find('.product_menu').css('display', 'none')
  })

  $(document).on('click', '.product_menu .dtit', function (e) {
    console.log(this.id)
    window.location.href = '/index/index/product?type=' + this.id
  })
</script>
